<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
    <caption>商品表</caption>
    <tr>
        <th>商品标题</th>
        <th>商品价格</th>
        <th>商品销量</th>
    </tr>
</table>
<script>
    let p1={}
    p1.name = "李斯";
    p1.age =25;
    p1.run = function () {
        console.log(this.name+":"+this.age)
    }
    p1.run()
    let p2={
        name:"韩非",
        age:23,
        run:function (){
            console.log(this.name+"："+this.age)
        }
    }
    p2.run();

    let arr=[{title:"小米手机",price:5000,SaleCount:200},
        {title:"李宁球鞋",price:500,SaleCount:100},
        {title:"华为电视",price:5000,SaleCount:200} ,
        {title:"苹果14pro max 1TB 暗夜紫",price:10000,SaleCount:2}]
    let table = document.querySelector("table")
    for(let product of arr){
        let tr = document.createElement("tr");
        let titleId = document.createElement("td")
        let priceId = document.createElement("td")
        let saleCountId = document.createElement("td")
        titleId.innerText = product.title
        priceId.innerText = product.price
        saleCountId.innerText =product.SaleCount
        tr.append(titleId,priceId,saleCountId)
        table.append(tr)

    }



</script>
</body>
</html>